//
//  CalendarFakeEventCell.m
//  OfficeBook
//
//  Created by 孙晓奇 on 15/10/11.
//  Copyright © 2015年 sunny. All rights reserved.
//

#import "CalendarFakeEventCell.h"
#import "CalendarCollectionViewEditableLayout.h"

@implementation CalendarFakeEventCell

-(void)forkDataFromOtherCell:(CalendarEventCell *)cell{
    if (cell.title.text != nil) {
        self.title.attributedText = [[NSAttributedString alloc] initWithString:cell.title.text
                                                                    attributes:[self titleAttributesHighlighted:YES]];
        self.title.adjustsFontSizeToFitWidth = YES;
    }
    if (cell.location.text != nil) {
        self.location.attributedText = [[NSAttributedString alloc] initWithString:cell.location.text
                                                                       attributes:[self titleAttributesHighlighted:YES]];
        self.location.adjustsFontSizeToFitWidth = YES;
    }
    if (cell.subject.text != nil) {
        self.subject.attributedText = [[NSAttributedString alloc] initWithString:cell.subject.text
                                                                       attributes:[self titleAttributesHighlighted:YES]];
        self.subject.adjustsFontSizeToFitWidth = YES;
    }
}

#pragma mark - Animation
-(void)cellCreatedAnimation:(BOOL)animation {
    if (animation == YES) {
        [UIView animateWithDuration:0.1 animations:^{
            self.transform = CGAffineTransformMakeScale(1.25, 1.25);
            self.bodyView.layer.shadowOpacity = 0.2;
            //NSLog(@"frame1:%@", NSStringFromCGRect(self.frame));
        } completion:^(BOOL finished) {
            [UIView animateWithDuration:0.1 animations:^{
                self.transform = CGAffineTransformIdentity;
                //NSLog(@"frame2:%@", NSStringFromCGRect(self.frame));
            }];
        }];
    }
}

-(void)cellSelectedAnimation:(BOOL)animation{
    if (animation == YES) {
        [UIView animateWithDuration:0.1 animations:^{
            self.transform = CGAffineTransformMakeScale(1.025, 1.025);
            self.bodyView.layer.shadowOpacity = 0.2;
        } completion:^(BOOL finished) {
            [UIView animateWithDuration:0.1 animations:^{
                self.transform = CGAffineTransformIdentity;
            }];
        }];
    }
}

@end
